﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Cherish.LScheduler.Website.Models
{
    public class RequestResult
    {
        public const string Success = "Success";
        public const string Error = "Error";
        public RequestResult(string result, string message = null)
        {
            this.Result = result;
            this.Message = message;
        }

        public RequestResult(bool isSucess, string message = null)
        {
            if (isSucess)
            {
                this.Result = RequestResult.Success;
            }
            else
            {
                this.Result = RequestResult.Error;
            }
            this.Message = message;
        }

        public string Result
        {
            get;
            set;
        }
        public string Message
        {
            get;
            set;
        }

        public static RequestResult DefaultErrorResult
        {
            get
            {
                return new RequestResult(false, "操作时发生异常，请在刷新页面后重新尝试");
            }
        }

        public static RequestResult DefaultSuccessResult
        {
            get
            {
                return new RequestResult(true);
            }
        }
    }
}